<?php
/* @var $this FuncionarioController */
/* @var $model Funcionario */

$this->breadcrumbs=array(
	'Colaboradores'=>array('index'),
	'Gerenciar',
);

$this->menu=array(
	array('label'=>'Cadastrar Colaborador', 'url'=>array('create')),
);

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$('#funcionario-grid').yiiGridView('update', {
		data: $(this).serialize()
	});
	return false;
});
");
?>

<h2>Colaboradores</h2>


<div class="search-form" style="display:none">
<?php $this->renderPartial('_search',array(
	'model'=>$model,
)); ?>
</div><!-- search-form -->
<?php $idAtual = Yii::app()->session['idAtual']; ?>
<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'funcionario-grid',
	'dataProvider'=>$model->search(),
	'columns'=>array(
		'id',
		'pessoa_id',
		'polo_id',
		'pis_pasep',
		'tipo',
		'horario',
		/*
		'curso_formacao',
		'instituicao_ensino',
		'observacao',
		*/
		array(
			'class'=>'CButtonColumn',
                        'template' => '{view}{update}{delete}',
                        'deleteConfirmation'=>"js:'Deseja Realmente excluir este Colaborador?'",
                        'buttons' => array (
                            'view' => array (
                                'visible'=> '$data->id != '.$idAtual,
                                ),
                            'update' => array (
                                'visible'=> '$data->id != '.$idAtual,
                            ),
                             'delete' => array (
                                'visible'=> '$data->id != '.$idAtual,
                            ),
                        )
		),
	),
)); ?>
